/**
 * futures : masterlink.futures.vo.FutpabReal.java
 */
package masterlink.futures.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * TODO Write the description
 *
 * @author : tonyyang
 * Create date : 2011/11/8
 * @version 1.0.0	
 */
@Entity
@Table(name="FutpabReal")
public class FutpabReal implements Serializable{

	private static final long serialVersionUID = -7837804127952914715L;
	@EmbeddedId
	private FutpabRealPk id;
	@Column(name="quantity")
	private Integer quantity;
	@Column(name="avgprice")
	private Double avgPrice;
	@Column(name="date1")
	private Integer date1;
	
	/**
	 * @return the id
	 */
	public FutpabRealPk getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(FutpabRealPk id) {
		this.id = id;
	}

	/**
	 * @return the quantity
	 */
	public Integer getQuantity() {
		return quantity;
	}

	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	/**
	 * @return the avgPrice
	 */
	public Double getAvgPrice() {
		return avgPrice;
	}

	/**
	 * @param avgPrice the avgPrice to set
	 */
	public void setAvgPrice(Double avgPrice) {
		this.avgPrice = avgPrice;
	}

	/**
	 * @return the date1
	 */
	public Integer getDate1() {
		return date1;
	}

	/**
	 * @param date1 the date1 to set
	 */
	public void setDate1(Integer date1) {
		this.date1 = date1;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof FutpabReal))
			return false;
		FutpabReal other = (FutpabReal) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("FutpabReal [id=");
		builder.append(id);
		builder.append(", quantity=");
		builder.append(quantity);
		builder.append(", avgPrice=");
		builder.append(avgPrice);
		builder.append(", date1=");
		builder.append(date1);
		builder.append("]");
		return builder.toString();
	}

	@Embeddable
	public static class FutpabRealPk implements Serializable{

		private static final long serialVersionUID = 9010493190491141658L;
		@Column(name="acno")
		private String acno;
		@Column(name="BROKER_ID")
		private String broker;
		@Column(name="trid")
		private String trid;
		@Column(name="buysell")
		private String buySell;
		@Column(name="tag1")
		private int tag1;
		/**
		 * @return the acno
		 */
		public String getAcno() {
			return acno;
		}
		/**
		 * @param acno the acno to set
		 */
		public void setAcno(String acno) {
			this.acno = acno;
		}
		/**
		 * @return the broker
		 */
		public String getBroker() {
			return broker;
		}
		/**
		 * @param broker the broker to set
		 */
		public void setBroker(String broker) {
			this.broker = broker;
		}
		/**
		 * @return the trid
		 */
		public String getTrid() {
			return trid;
		}
		/**
		 * @param trid the trid to set
		 */
		public void setTrid(String trid) {
			this.trid = trid;
		}
		/**
		 * @return the buySell
		 */
		public String getBuySell() {
			return buySell;
		}
		/**
		 * @param buySell the buySell to set
		 */
		public void setBuySell(String buySell) {
			this.buySell = buySell;
		}
		/**
		 * @return the tag1
		 */
		public int getTag1() {
			return tag1;
		}
		/**
		 * @param tag1 the tag1 to set
		 */
		public void setTag1(int tag1) {
			this.tag1 = tag1;
		}

		/* (non-Javadoc)
		 * @see java.lang.Object#toString()
		 */
		@Override
		public String toString() {
			StringBuilder builder = new StringBuilder();
			builder.append("FutpabRealPk [acno=");
			builder.append(acno);
			builder.append(", broker=");
			builder.append(broker);
			builder.append(", trid=");
			builder.append(trid);
			builder.append(", buySell=");
			builder.append(buySell);
			builder.append(", tag1=");
			builder.append(tag1);
			builder.append("]");
			return builder.toString();
		}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((acno == null) ? 0 : acno.hashCode());
			result = prime * result
					+ ((broker == null) ? 0 : broker.hashCode());
			result = prime * result
					+ ((buySell == null) ? 0 : buySell.hashCode());
			result = prime * result + tag1;
			result = prime * result + ((trid == null) ? 0 : trid.hashCode());
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			FutpabRealPk other = (FutpabRealPk) obj;
			if (acno == null) {
				if (other.acno != null)
					return false;
			} else if (!acno.equals(other.acno))
				return false;
			if (broker == null) {
				if (other.broker != null)
					return false;
			} else if (!broker.equals(other.broker))
				return false;
			if (buySell == null) {
				if (other.buySell != null)
					return false;
			} else if (!buySell.equals(other.buySell))
				return false;
			if (tag1 != other.tag1)
				return false;
			if (trid == null) {
				if (other.trid != null)
					return false;
			} else if (!trid.equals(other.trid))
				return false;
			return true;
		}
		
	}
}
